package com.yohann.designPattern.prototype.shallowCopy;

import com.yohann.designPattern.prototype.clone.Sheep;

/**
 * <p>
 * 客户端
 * </p>
 *
 * @author Yohann
 * @since 2021/2/2 15:40
 */
public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
        Sheep2 sheep2 = new Sheep2("pony", "yellow");
        sheep2.friend = new Sheep("jack", "green");

        Sheep2 clone1 = (Sheep2) sheep2.clone();
        Sheep2 clone2 = (Sheep2) sheep2.clone();

        //false
        System.out.println(clone1 == clone2);
        //true
        System.out.println(clone1.friend == clone2.friend);
    }
}